package com.titanium.java;


import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

/**
 *@program: JavaSenior
 *@description:
 *@author: renfei.huang
 *@create: 2021-10-13 14:29
 */
public class PropertiesTest {



    //Properties 处理配置文件夹key和value都是String类型
    public static void main(String[] args) {
        FileInputStream fis = null;
        try {
            Properties properties = new Properties();

            fis = new FileInputStream("jdbc.properties");

            properties.load(fis);

            String name = properties.getProperty("name");
            String passsword = properties.getProperty("password");
            System.out.println("name= "+ name + ",password = " +passsword);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if(fis!=null){
                try {
                    fis.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

    }
}
